package com.bw.controller;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.bw.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author ${郭冬胜}
 * @date 2025/8/5 11:33
 */
@RestController
public class UserController {
    @Autowired
    UserService userService;
    @RequestMapping("/full")
    public Object t1(){
        List<Map> list=userService.full();
        JSONObject jsonObject1 = new JSONObject();
        jsonObject1.put("status",0);
        jsonObject1.put("msg","");
        JSONArray objects = new JSONArray();
        JSONObject jsonObject2 = new JSONObject();
        jsonObject2.put("name","接单数");
        jsonObject2.put("value",list.get(0).get("c"));
        objects.add(jsonObject2);
        JSONObject jsonObject3 = new JSONObject();
        jsonObject3.put("name","接单数");
        jsonObject3.put("value",list.get(0).get("c1"));
        objects.add(jsonObject3);
        JSONObject jsonObject4 = new JSONObject();
        jsonObject4.put("name","接单数");
        jsonObject4.put("value",list.get(0).get("c2"));
        objects.add(jsonObject4);
        jsonObject1.put("data",objects);
        return jsonObject1;
    }
    @RequestMapping("/fullA")
    public Object t2(){
        List<Map> list=userService.fullA();
        JSONObject jsonObject1 = new JSONObject();
        jsonObject1.put("status",0);
        jsonObject1.put("msg","");
        JSONArray objects = new JSONArray();

        for (Map map : list) {
            JSONObject jsonObject2 = new JSONObject();
            jsonObject2.put("name",map.get("sss"));
            jsonObject2.put("value",map.get("c"));
            objects.add(jsonObject2);
        }
        jsonObject1.put("data",objects);
        return jsonObject1;
    }
}
